//
//  KYCityWeatherVC-UI.swift
//  ZhiYunWeather
//
//  Created by Wade on 2024/7/10.
//

import Foundation
import UIKit
import QMUIKit
extension KYCityWeatherVC{
    func setupSubViews(){
        let header = UIView()
        self.view.addSubview(header)
        header.backgroundColor = .clear
        header.snp.makeConstraints { make in
            make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top)
            make.right.equalTo(self.view)
            make.left.equalTo(self.view)
            make.height.equalTo(44)
        }
        
        let listView = UIView()
        header.addSubview(listView)
        header.backgroundColor = .clear
        listView.snp.makeConstraints { make in
            make.top.bottom.equalTo(header)
            make.left.equalTo(header).offset(10)
            make.width.equalTo(280)
        }
        
        let locationBtn = QMUIButton()
        locationBtn.imagePosition = .left
        listView.addSubview(locationBtn)
        locationBtn.snp.makeConstraints { make in
            make.left.top.bottom.equalTo(listView)
            make.width.equalTo(240)
        }
        locationBtn.setImage(UIImage(named: "input_location_add_via_point_Normal"), for: .normal)
        locationBtn.setTitle("西青区 滨海新区开发区2号11112", for: .normal)
        locationBtn.titleLabel?.lineBreakMode = .byTruncatingTail
        locationBtn.addTarget(self, action: #selector(listBtnClick), for: .touchUpInside)
        
        let locationImage = UIImageView()
        locationImage.image = UIImage(named: "ic_poi_dingwei")
        listView.addSubview(locationImage)
        locationImage.contentMode = .scaleAspectFit
        locationImage.snp.makeConstraints { make in
            make.centerY.equalTo(listView)
            make.width.height.equalTo(30)
            make.left.equalTo(locationBtn.snp.right).offset(5)
        }
        
        let utilsBtn = UIButton()
        header.addSubview(utilsBtn)
        utilsBtn.setImage(UIImage(named: "ic_mycolloect"), for: .normal)
        utilsBtn.snp.makeConstraints { make in
            make.top.bottom.equalTo(header)
            make.width.equalTo(44)
            make.right.equalTo(header).offset(-10)
        }
        utilsBtn.addTarget(self, action: #selector(utilsBtnClick), for: .touchUpInside)
    }
}
